//
//  FourCollectionViewCell.m
//  HandWork
//
//  Created by 王阳阳 on 16/1/21.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "FourCollectionViewCell.h"

#import "UIColor+colorChange.h"
@implementation FourCollectionViewCell
- (void)dealloc
{
    [_bgphoto release];
    [_collectable release];
    [_likelabel release];
    [_titlelabel release];
    [_user_name release];
    [_bgview release];
    [super dealloc];
}
#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}
- (void)create
{
    //图片
    self.bgphoto = [[UIImageView alloc]init];
    [self.contentView addSubview:self.bgphoto];
    [_bgphoto release];
    //颜色
    self.bgview = [[UIView alloc]init];
    [self.contentView addSubview:self.bgview];
    [_bgview release];
    //标题
    self.titlelabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.titlelabel];
    [_titlelabel release];
    //作者
    self.user_name = [[UILabel alloc]init];
    [self.contentView addSubview:self.user_name];
    [_user_name release];
    //喜欢按钮
    self.likebut = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.bgview addSubview:self.likebut];
    //喜欢个数
    self.likelabel = [[UILabel alloc]init];
    [self.bgview addSubview:self.likelabel];
    [_likelabel release];
    //收藏按钮
    self.collectbut = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.bgview addSubview:self.collectbut];
    //收藏个数
    self.collectable = [[UILabel alloc]init];
    [self.bgview addSubview:self.collectable];
    [_collectable release];
    
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    //图片
    self.bgphoto.frame =  CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width / 2 - 20 , [UIScreen mainScreen].bounds.size.width / 2 - 30);
    
    //title名字
    self.titlelabel.frame = CGRectMake(0, self.bgphoto.frame.size.height, [UIScreen mainScreen].bounds.size.width / 2 - 20, 30);
    self.titlelabel.textColor = [UIColor whiteColor];//字体颜色

    //随机颜色
    self.bgview.frame = CGRectMake(0, self.bgphoto.frame.size.height, [UIScreen mainScreen].bounds.size.width / 2 - 20, 80);
    //制作者姓名
    self.user_name.frame = CGRectMake(0, self.bgphoto.frame.size.height +  30, self.contentView.frame.size.width, 30);
    self.user_name.font = [UIFont systemFontOfSize:14];//字体大小
    self.user_name.textColor = [UIColor whiteColor];
  
    //收藏按钮
    
    
    self.collectbut.frame = CGRectMake(10, 60,20, 20);
    [self.collectbut setImage:[UIImage imageNamed:@"collect"] forState:UIControlStateNormal];
    //收藏个数
    self.collectable.frame = CGRectMake(40, 55, 30, 30);
    self.collectable.textColor = [UIColor whiteColor];//字体颜色
    self.collectable.font = [UIFont systemFontOfSize:14];//字体大小

    //喜欢按钮
    self.likebut.frame = CGRectMake(70,55, 30, 30);
    [self.likebut setImage:[UIImage imageNamed:@"red_heart"] forState:UIControlStateNormal];
    //喜欢个数
    self.likelabel.frame = CGRectMake(110, 55, 40, 30);
    self.likelabel.textColor = [UIColor whiteColor];//字体颜色
    self.likelabel.font = [UIFont systemFontOfSize:14];//字体大小

}

@end
